package com.tedu.comment.controller;

import com.tedu.comment.pojo.dto.CommentQuery;
import com.tedu.comment.pojo.vo.AuditCommentVO;
import com.tedu.comment.pojo.vo.CommentVO;
import com.tedu.comment.service.CommentService;
import com.tedu.common.response.JsonResult;
import com.tedu.common.response.PageData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/p1/admin")
public class CommentController {
    @Autowired
    CommentService commentService;
    @PostMapping("/comment")
    public JsonResult comment(CommentQuery commentQuery){
        log.debug("用户评论控制层参数:{}",commentQuery);
        String audit = commentService.audit(commentQuery);
        return JsonResult.ok(audit);

    }
    @GetMapping("/load")
    public JsonResult load(CommentQuery commentQuery){
        log.debug("用户评论控制层参数-入参:{}",commentQuery);
        PageData data=commentService.loadComment(commentQuery);
        log.debug("用户评论控制层参数-出参:{}",data);
        return JsonResult.ok(data);
    }
    @PostMapping("/pass")
    public JsonResult pass(CommentQuery commentQuery){
        log.debug("用户评论控制层参数-入参:{}",commentQuery);
        commentService.pass(commentQuery);
        return JsonResult.ok();

    }
    @PostMapping("/confirm/")
    public JsonResult confirm(CommentQuery commentQuery){
        log.debug("用户确认审核控制层参数---入参:{}",commentQuery);
        commentService.confirm(commentQuery);
        return JsonResult.ok();

    }
    @PostMapping("/back")
    public JsonResult back(CommentQuery commentQuery){
        log.debug("用户评论控制层参数-入参:{}",commentQuery);
        commentService.back(commentQuery);
        return JsonResult.ok();

    }

}
